let class_name = "android/pay/PayGBox";
let ANDROIDApi = {

    init(data, adsdk) {
        this.ADSdk = adsdk;
        this.bannerId = data.ad.bannerId;
        this.videoId = data.ad.videoId;
        this.insertId = data.ad.insertId;
    },

    // 0 Banner
    // 1 视频
    // 2 闪屏
    // 3 移除Banner
    // 4 移除插屏信息流
    // 5 双倍奖励界面红包插屏信息流
    // 6 提现界面红包插屏信息流
    // 7 登录

    pay(payId) {
        if (cc.sys.platform != cc.sys.ANDROID) return;
        jsb.reflection.callStaticMethod(class_name, "payjni", "(I)V", payId); //(I)V 表示参数为一个int，没有返回值的方法
    },

    moreGame() {
        if (cc.sys.platform != cc.sys.ANDROID) return;
        jsb.reflection.callStaticMethod(class_name, "moreGame", "()V");
    },

    about() {
        if (cc.sys.platform != cc.sys.ANDROID) return;
        jsb.reflection.callStaticMethod(class_name, "about", "()V");
    },

    exitGame() {
        if (cc.sys.platform != cc.sys.ANDROID) return;
        jsb.reflection.callStaticMethod(class_name, "exitGame", "()V");
    },

    isOpenMusic() {
        if (cc.sys.platform != cc.sys.ANDROID) return;
        let isopenmusic = jsb.reflection.callStaticMethod(class_name, "isOpenMusic", "()Z");
    },

    javaGetUDID() {
        if (cc.sys.platform != cc.sys.ANDROID) return;
        let uid = jsb.reflection.callStaticMethod(class_name, "getUDID", "()Ljava/lang/String;");
        return uid;
    },

    payFail(payId) {
        // switch (payId) {
        //     case 0:
        //         break;
        //     default:
        //         break;
        // }

        if (this.videocallback) this.videocallback(-1);
    },



    payOk(payId) {
        // switch (payId) {
        //     case AppConst.PayId.VideoMain:
        //         this.GameUI.videoEnd();
        //         break;
        //     case AppConst.PayId.VideoSign:
        //         this.GameUI.sighSuccess();
        //         break;
        //     case AppConst.PayId.VideoGame:
        //         this.GameUI.videoEnd();
        //         break;
        //     case AppConst.PayId.VideoRelive:
        //         this.GameUI.reliveSuccess();
        //         break;
        //     case AppConst.PayId.VideoProp1:
        //     case AppConst.PayId.VideoProp2:
        //     case AppConst.PayId.VideoProp3:
        //         this.GameUI.getPropSuccess();
        //         break;
        //     case AppConst.PayId.VideoDoubleRedNum:
        //         this.GameUI.getDoubleSucess();
        //         break;
        //     default:
        //         break;
        // }

        if (this.videocallback) this.videocallback(1,payId);
    },
    //------------------------------------


    showVideo(adUnitId, cb) {
        this.videocallback = cb;
        this.pay(this.videoId)
    },

    showBanner(adUnitId) {
        this.pay(this.bannerId)
    },

    showInsertAd(adUnitId = this.insertId) {
        // this.ADSdk.showToast("插屏：" + adUnitId)
        this.pay(adUnitId)
    },

    hideInsertAd(adUnitId = 4) {
        this.pay(adUnitId)
    },

    hideBanner(adUnitId = 3) {
        this.pay(adUnitId)
    },


    login(cb) {
        this.pay(7)
        this.videocallback = cb;
    },

    // loginSuccess(data){
    //     if (this.videocallback) this.videocallback(1,data);
    // },

    share(){

    },
};
module.exports = ANDROIDApi;